<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
</head>

<body>
    <div id="app">
<cpn1></cpn1>
<cpn4></cpn4>
    </div>
<script>
    //创建第一个组件构造器
    const cpnC1=Vue.extend({
     template:`
     <div>
     <h1>我是组件构造器一</h1>
    <p>我是孙悟空</p>
     </div>
     `
    })

Vue.component('cpn4',{
    template:`
     <div>
     <h1>我是组件构造器一</h1>
    <p>我是一个注册的全局组件</p>
     </div>
     `
})
    const cpnC2=Vue.extend({
     template:`
     <div>
     <h1>我是组件构造器二</h1>
    <p>我是孙悟空</p>
     </div>
     `
    },
    
    )
</script>
    
    <script>
        var vm=new Vue({
           el:'#app',
           data:{},
           methods:{},
           components:{
               cpn1:cpnC1,
               cpn2:cpnC2
           },
        });
    </script>
</body>

</html>